﻿using System;
using System.Collections.Generic;
using SellAvi.Model;

namespace SellAvi.Classes
{
    abstract public class AvitoTask
    {
        public delegate AvitoTaskStatus OperationDelegate();
        protected AbstractModel _taskItem;
        public WebClientEx WebClient { get; set; }
        public abstract string TaskName { get; }
        public abstract string TaskDescription { get; }
        public abstract List<OperationDelegate> TaskExecutionPlan { get; }
        public int TaskDelay { get; set; }

        public abstract string TaskCompletedUrl { get; }

        public Type TaskType { get; set; }

        protected AvitoTask(AbstractModel am)
        {
            _taskItem = am;
            TaskType = typeof(AbstractModel);
        }


        public AvitoTaskStatus TaskStatus { get; set; }
        public int? StatusCode
        {
            get
            {
                return TaskStatus != null ? TaskStatus.ErrorCode : null;
            }
        }

    }
}
